package com.voltmao.service.application.sys;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.voltmao.persistent.mapper.AdminMenuFunMapper;
import com.voltmao.persistent.mapper.AdminMenuMapper;

import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;

/**
 * Created by zhouyang on 2018/1/29.
 */
@Service
public class UserInfoServiceImpl {

    @Autowired
    AdminMenuMapper adminMenuMapper;
    @Autowired
    AdminMenuFunMapper adminMenuFunMapper;
//    @Autowired
//    SysDictionaryMapper sysDictionaryMapper;


    /**
     * 登录初始化数据
     *
     * @param opneid
     * @return
     */
    public Map<String, Object> getMenuData(String opneid) {
        Map<String, Object> result = new HashMap<String, Object>();

        //查询菜单组
//        result.put("menuRules", adminMenuMapper.selectMenusByOpenid(opneid));

        //查询功能组
//        result.put("funRules", adminMenuFunMapper.selectFunsByOpenid(opneid));

        //查询用户
//        result.put("userInfo",sysUserInfoMapper.selectByPrimaryKey(opneid));

        //查询字典组
//        SysDictionaryCriteria example = new SysDictionaryCriteria();
//        example.setOrderByClause("sort_num");
//        result.put("dicJson",sysDictionaryMapper.selectByExample(example));

        return result;
    }

//    /**
//     * 验证登录
//     * @param params
//     * @param request
//     * @return
//     */
//    public SysUserInfo authLogin(Map<String, Object> params, HttpServletRequest request) {
//        SysUserInfoCriteria example = new SysUserInfoCriteria();
//        SysUserInfoCriteria.Criteria c = example.createCriteria();
//        c.andUserNameEqualTo(params.get("signName")+"");
//        c.andPwdEqualTo(params.get("passWord")+"");
//        SysUserInfo sysUserInfo = sysUserInfoMapper.selectByExampleForOne(example);
//
//        return sysUserInfo;
//    }
}
